package com.deyuanyun.pic.ctrl.controller.vo.exinsp;

import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.ctrl.domain.ExinspReference;
import com.deyuanyun.pic.ctrl.enumeration.AbnormalEnum;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

/**
 * 长效参比电极检测记录表 视图对象
 *
 * @author huanglw
 * @date  2016-9-7
 *
 * History: [修改人][时间][修改描述]
 */
public class ExinspReferenceVO extends ExinspBaseVO<ExinspReference> {

    // 管道名称
    private String pipeLineName;
    // 设备编号(自定义编号)
    private String customNumber;
    // 测试桩编号
    private String testStationNum;
    // 位置描述
    private String lacationDescription;
    // 长效饱和硫酸铜参比电极校准_实测参比测量电位（mV）
    public Long measuredReferencePotential;
    // 长效饱和硫酸铜参比电极校准_标准参比测量电位（mV）
    public Long standardReferencePotential;
    // 高纯锌参比电极_实测开路电位（相对SCE）（mV）
    public Long measuredOpenPotential;
    // 高纯锌参比电极_标准开路电位（相对SCE）（mV）
    public Long standardOpenPotential;
    // 维护记录
    private String maintenanceRecord;
    // 异常记录
    private String faultRecord;
    // 处理措施
    private String treatmentMeasures;
    // 检测日期
    private String detectiongDete;
    // 是否有异常(YES、NO)
    private String abnormal;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public String getTestStationNum() {
        return testStationNum;
    }

    public void setTestStationNum(String testStationNum) {
        this.testStationNum = testStationNum;
    }

    public String getLacationDescription() {
        return lacationDescription;
    }

    public void setLacationDescription(String lacationDescription) {
        this.lacationDescription = lacationDescription;
    }

    public Long getMeasuredReferencePotential() {
        return measuredReferencePotential;
    }

    public void setMeasuredReferencePotential(Long measuredReferencePotential) {
        this.measuredReferencePotential = measuredReferencePotential;
    }

    public Long getStandardReferencePotential() {
        return standardReferencePotential;
    }

    public void setStandardReferencePotential(Long standardReferencePotential) {
        this.standardReferencePotential = standardReferencePotential;
    }

    public Long getMeasuredOpenPotential() {
        return measuredOpenPotential;
    }

    public void setMeasuredOpenPotential(Long measuredOpenPotential) {
        this.measuredOpenPotential = measuredOpenPotential;
    }

    public Long getStandardOpenPotential() {
        return standardOpenPotential;
    }

    public void setStandardOpenPotential(Long standardOpenPotential) {
        this.standardOpenPotential = standardOpenPotential;
    }

    public String getMaintenanceRecord() {
        return maintenanceRecord;
    }

    public void setMaintenanceRecord(String maintenanceRecord) {
        this.maintenanceRecord = maintenanceRecord;
    }

    public String getFaultRecord() {
        return faultRecord;
    }

    public void setFaultRecord(String faultRecord) {
        this.faultRecord = faultRecord;
    }

    public String getTreatmentMeasures() {
        return treatmentMeasures;
    }

    public void setTreatmentMeasures(String treatmentMeasures) {
        treatmentMeasures = treatmentMeasures;
    }

    public String getDetectiongDete() {
        return detectiongDete;
    }

    public void setDetectiongDete(String detectiongDete) {
        this.detectiongDete = detectiongDete;
    }

    public String getAbnormal() {
        return abnormal;
    }

    public void setAbnormal(String abnormal) {
        this.abnormal = abnormal;
    }

    public void fromDomain(ExinspReference domain) {

        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 设备编号(自定义编号)
        this.customNumber = domain.getCustomNumber();
        // 测试桩编号
        this.testStationNum = domain.getTestStationId();
        // 位置描述
        this.lacationDescription = domain.getLacationDescription();
        // 长效饱和硫酸铜参比电极校准_实测参比测量电位（mV）
        this.measuredReferencePotential = domain.getMeasuredReferencePotential();
        // 长效饱和硫酸铜参比电极校准_标准参比测量电位（mV）
        this.standardReferencePotential = domain.getStandardReferencePotential();
        // 高纯锌参比电极_实测开路电位（相对SCE）（mV）
        this.measuredOpenPotential = domain.getMeasuredOpenPotential();
        // 高纯锌参比电极_标准开路电位（相对SCE）（mV）
        this.standardOpenPotential = domain.getStandardOpenPotential();
        // 维护记录
        this.maintenanceRecord = domain.getMaintenanceRecord();
        // 异常记录
        this.faultRecord = domain.getFaultRecord();
        // 是否有异常(YES、NO)
        this.abnormal = AbnormalEnum.getLabel(domain.getAbnormal());
        // 处理措施(分到其他表中，暂时还不知道如何处理)
        this.treatmentMeasures = domain.getUpdateRemark();
        // 检测日期
        this.detectiongDete = DateFormat.format(domain.getDetectiongDete());

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<ExinspReferenceVO> fromDomainList(Page<ExinspReference> domainList) {

        Page<ExinspReferenceVO> list = new Page<ExinspReferenceVO>();
        for (ExinspReference exinspReference : domainList) {
            ExinspReferenceVO exinspReferenceVO = new ExinspReferenceVO();
            exinspReferenceVO.fromDomain(exinspReference);
            list.add(exinspReferenceVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}